package com.example.accessingdatajpa.service;

import com.example.accessingdatajpa.pojo.Customer;
import com.example.accessingdatajpa.pojo.ShoppingCart;
import com.example.accessingdatajpa.response.RestResponse;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.transaction.Transactional;
import java.util.List;

public interface IShoppingCartService {
    //find all goods in shopping cart
    @Transactional
    RestResponse<List<ShoppingCart>> queryAllInShoppingCartById(Long customerId);

    //find goods in order management
    @Transactional
    RestResponse<List<ShoppingCart>> queryAllGoodsInOM(Long customerId, Boolean isSubmit);

    //find all goods in order management or shopping cart(cookie实验版本)
    //isSubmit为true显示的是订单中的全部商品，false时显示的是购物车中的全部商品
    @Transactional
    RestResponse<List<ShoppingCart>> queryGoodsInOM(Long customerId, Boolean isSubmit, HttpServletRequest request, HttpServletResponse rep);

    //find goods in order management
    //order management为0时是提交订单未付款，为1时是付款未提货，为2时是已提货
    @Transactional
    RestResponse<List<ShoppingCart>> queryGoodsInOM(Long customerId, Integer orderManagement);

    //add new goods in shopping cart
    //新添加商品时添加至为isSubmit为false的字段
    @Transactional
    RestResponse<String> addInShoppingCart(ShoppingCart shoppingCart, Long customerId);

    //add new goods in shopping cart
    @Transactional
    RestResponse<String> addShoppingCart(ShoppingCart shoppingCart, Long customerId, HttpServletRequest request, HttpServletResponse rep);

    //update the account of goods and re-calculate the total value
    @Transactional
    RestResponse<String> updateAccountInCartById(Long shoppingId, Long goodsAmount);

    //select the goods or not
    @Transactional
    RestResponse<String> chooseGoods(Long shoppingId, Boolean goodsSelect);

    //order management
    @Transactional
    RestResponse<String> manageOrder(Long shoppingId, Boolean isSubmit, Integer orderManagement);

    //delete goods by id
    @Transactional
    RestResponse<String> deleteGoods(Long shoppingId);
}
